#ifndef SALESMANDATA_H_
#define SALESMANDATA_H_

#include "SalesmanCity.h"

#include <QDebug>

#include <QString>
#include <QVector>
#include <QStringList>

/**
  * Class that contains cities for travelling salesman problem
  * @author Łukasz Szybka
  */
class SalesmanData
{
public:

    SalesmanData();
    SalesmanData(QString filePath, QString fileName);
    SalesmanData(const SalesmanData& other);
    ~SalesmanData();


    //void addCity(QString name, QString distStr);
    //void addCity(QString name, double coordX, double coordY);
	
    void addCity(SalesmanCity city);
	
    SalesmanCity getCity(int index);
	
    int size();
    void clear();

    bool saveToFile(QString filePath, QString fileName);
    QByteArray readFromFile(QString filePath, QString fileName);
    QByteArray generateXML();

    double distance(int from, int to) const;
    QVector<double> getCityDistanceVector(int index) const;

    SalesmanData& operator=(const SalesmanData& other);

    friend QDebug operator<<(QDebug dbg, const SalesmanData& sud);

    QList<int> findBestSalesmanRouteBF();

protected:
    void addCity(QVector<double> dist);

    QList<SalesmanCity> cityList;
    QVector<QVector<double> > distanceArr;

private:
    QList<int> getNextPermutation(QList<int> lastPermutation);
};

#endif /*SALESMANDATA_H_*/
